<?php
/**
 * 内部端口复用
 */
use  \Workerman\Worker;
$worker = new Worker('http://0.0.0.0:2016');

$worker->count = 4;
$worker->name = 'start_test01_worker';
$worker->onWorkerStart = function ($worker){
  $inner_worker = new Worker('http://0.0.0.0:2017');
  $inner_worker->onMessage = 'on_message';
  $inner_worker->reusePort = true;
  $inner_worker->name = 'inner_worker';
  $inner_worker->listen();
};

$worker->onMessage = 'on_message';

function on_message($connection,$data){
    $connection->send("hello \n");
}
if(!defined('GLOBAL_START'))
{
    Worker::runAll();
}
